import request from '@/utils/request'

//获取教师信息
export const getTeacherInfoAPI = () => {
    return request.get('/teacher/my')
}
//修改教师信息
export const updateTeacherInfoAPI = (params) => {
    return request.put('/teacher/my', params)
}
//获取我的学生信息
export const getMyStudentsAPI = () => {
    return request.get('/teacher/myStudents')
}
//获取我布置的作业
export const getMyHomeworkAPI = () => {
    return request.get('/teacher/myAssignments')
}
//布置作业
export const assignHomeworkAPI = (data) => {
    return request.post('/teacher/assignment', data)
}
//获取学生作业完成情况
export const getStudentHomeworkAPI = ({ assignmentId } = {}) => {
  // 只有在 assignmentId 存在时才将其传递给 params
  const params = assignmentId ? { assignmentId } : {}

  return request.get('/teacher/myStudentAssignments', { params })
}

//评价学生作业
export const evaluateStudentHomeworkAPI = (id, { studentId,grade, feedback }) => {
    return request.put(`/teacher/gradingAssignments/${id}`, null, {
        params: {
            studentId,
            grade,
            feedback
        }
    })
}
